﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
    <title>Microwave: Test/MicrowaveTest/MicrowaveTest.cs Source File</title>
    <link href="/Content/Help.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/tabs.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div id="header">
        <img id="logo" alt="StateForge" src="/Content/Images/StateForgeLogo.png" />
        <div id="title">
            <h1>
                C# examples using state machines generated by StateBuilderDotNet
            </h1>
            <h3>
                Microwave: Test/MicrowaveTest/MicrowaveTest.cs Source File
            </h3>
        </div>
        <div id="menucontainer">
            <ul id="menu">
                <li><a href="/">Home</a></li>
                <li><a href="/Home/Download">Downloads</a></li>
                <li><a href="/Help/state-machine-tools.aspx">Help</a></li>
                <li><a href="/Home/Faq">F.A.Q</a></li>
                <li><a href="/Home/About">Contact us</a></li>
            </ul>
        </div>
    </div>
<!-- Generated by Doxygen 1.7.4 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">Test/MicrowaveTest/MicrowaveTest.cs</div>  </div>
</div>
<div class="contents">
<a href="_microwave_test_8cs.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 ﻿
<a name="l00002"></a>00002 <span class="keyword">namespace </span>StateForge.Examples.Microwave
<a name="l00003"></a>00003 {
<a name="l00004"></a>00004     <span class="keyword">using</span> System;
<a name="l00005"></a>00005     <span class="keyword">using</span> NUnit.Framework;
<a name="l00006"></a>00006     <span class="keyword">using</span> StateForge.StateMachine;
<a name="l00007"></a>00007     <span class="keyword">using</span> Rhino.Mocks;
<a name="l00008"></a>00008 
<a name="l00009"></a>00009     [TestFixture]
<a name="l00010"></a><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html">00010</a>     <span class="keyword">class </span><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html">MicrowaveTest</a>
<a name="l00011"></a>00011     {
<a name="l00012"></a><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#a3cd75b35463f69c5b54c706bcf3af967">00012</a>         <span class="keyword">private</span> <a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave.html" title="Microwave is a container class which hold instances of a MicrowaveActuator and a generated MicrowaveC...">Microwave</a> <a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#a3cd75b35463f69c5b54c706bcf3af967">microwave</a>;
<a name="l00013"></a><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#a9fbbefce4e70584b81ef088f667ba1be">00013</a>         <span class="keyword">private</span> MockRepository <a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#a9fbbefce4e70584b81ef088f667ba1be">repository</a>;
<a name="l00014"></a><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#a4000e26593812e9a8f67bbaf897cc814">00014</a>         <span class="keyword">private</span> IObserver <a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#a4000e26593812e9a8f67bbaf897cc814">observer</a>;
<a name="l00015"></a><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#a36d0baf442ffb573b424129561126043">00015</a>         <span class="keyword">private</span> <span class="keyword">static</span> String contextName = <span class="stringliteral">&quot;MicrowaveContext&quot;</span>;
<a name="l00016"></a><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#aa6957a2bf4ff10b39f03eb7bd7717f7e">00016</a>         <span class="keyword">private</span> <span class="keyword">static</span> String contextEngineName = <span class="stringliteral">&quot;MicrowaveEngineContext&quot;</span>;
<a name="l00017"></a><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#ae52b0e2084fd46dac7e07b0b74c69cfb">00017</a>         <span class="keyword">private</span> <span class="keyword">static</span> String contextDoorName = <span class="stringliteral">&quot;MicrowaveDoorContext&quot;</span>;
<a name="l00018"></a><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#a526596fea5cade2526c83644429d7a08">00018</a>         <span class="keyword">private</span> <span class="keywordtype">string</span> current, next, <a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#a526596fea5cade2526c83644429d7a08">transition</a>;
<a name="l00019"></a>00019 
<a name="l00020"></a>00020         [SetUp]
<a name="l00021"></a><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#ac7a3475e9ffbe149297977f59fcd27cd">00021</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> Setup()
<a name="l00022"></a>00022         {
<a name="l00023"></a>00023             repository = <span class="keyword">new</span> MockRepository();
<a name="l00024"></a>00024             observer = repository.StrictMock&lt;IObserver&gt;();
<a name="l00025"></a>00025             this.microwave = <span class="keyword">new</span> <a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave.html" title="Microwave is a container class which hold instances of a MicrowaveActuator and a generated MicrowaveC...">Microwave</a>();
<a name="l00026"></a>00026         }
<a name="l00027"></a>00027 
<a name="l00028"></a>00028         [TearDown]
<a name="l00029"></a><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#a66f2efe571f82043a0be9839625798d0">00029</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> TearDown()
<a name="l00030"></a>00030         {
<a name="l00031"></a>00031 
<a name="l00032"></a>00032         }
<a name="l00036"></a>00036         [Test]
<a name="l00037"></a><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#a928c0bd58390577520a4c46c5e681609">00037</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> EvStart()
<a name="l00038"></a>00038         {
<a name="l00039"></a>00039             this.microwave.Observer = observer;
<a name="l00040"></a>00040 
<a name="l00041"></a>00041             <span class="keyword">using</span> (repository.Record())
<a name="l00042"></a>00042             {
<a name="l00043"></a>00043                 <span class="keyword">using</span> (repository.Ordered())
<a name="l00044"></a>00044                 {
<a name="l00045"></a>00045                     <span class="comment">// this.context.EvStart();</span>
<a name="l00046"></a>00046                     current = <span class="stringliteral">&quot;Initial&quot;</span>; next = <span class="stringliteral">&quot;Operating&quot;</span>; transition = <span class="stringliteral">&quot;EvStart&quot;</span>;
<a name="l00047"></a>00047                     Expect.Call(() =&gt; this.observer.OnTransitionBegin(contextName, current, next, transition));
<a name="l00048"></a>00048 
<a name="l00049"></a>00049                     Expect.Call(() =&gt; this.observer.OnExit(contextName, current));
<a name="l00050"></a>00050                     Expect.Call(() =&gt; this.observer.OnEntry(contextName, next));
<a name="l00051"></a>00051 
<a name="l00052"></a>00052                     <span class="comment">// Entering in sub context engine</span>
<a name="l00053"></a>00053                     Expect.Call(() =&gt; this.observer.OnEntry(contextEngineName, <span class="stringliteral">&quot;Engine&quot;</span>));
<a name="l00054"></a>00054                     Expect.Call(() =&gt; this.observer.OnEntry(contextEngineName, <span class="stringliteral">&quot;EngineOff&quot;</span>));
<a name="l00055"></a>00055 
<a name="l00056"></a>00056                     <span class="comment">//Entering in sub context door</span>
<a name="l00057"></a>00057                     Expect.Call(() =&gt; this.observer.OnEntry(contextDoorName, <span class="stringliteral">&quot;Door&quot;</span>));
<a name="l00058"></a>00058                     Expect.Call(() =&gt; this.observer.OnEntry(contextDoorName, <span class="stringliteral">&quot;DoorClosed&quot;</span>));
<a name="l00059"></a>00059 
<a name="l00060"></a>00060                     Expect.Call(() =&gt; this.observer.OnTransitionEnd(contextName, current, next, transition));
<a name="l00061"></a>00061                 }
<a name="l00062"></a>00062             }
<a name="l00063"></a>00063 
<a name="l00064"></a>00064             <span class="keyword">using</span> (repository.Playback())
<a name="l00065"></a>00065             {
<a name="l00066"></a>00066                 this.microwave.EvStart();
<a name="l00067"></a>00067             }
<a name="l00068"></a>00068         }
<a name="l00072"></a>00072         [Test]
<a name="l00073"></a><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#a693589b019b277b59cadf250e015420f">00073</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> EvStart_EvStop()
<a name="l00074"></a>00074         {
<a name="l00075"></a>00075             this.microwave.EvStart();
<a name="l00076"></a>00076             this.microwave.Observer = observer;
<a name="l00077"></a>00077 
<a name="l00078"></a>00078             <span class="keyword">using</span> (repository.Record())
<a name="l00079"></a>00079             {
<a name="l00080"></a>00080                 <span class="keyword">using</span> (repository.Ordered())
<a name="l00081"></a>00081                 {
<a name="l00082"></a>00082                     <span class="comment">// this.context.EvStop();</span>
<a name="l00083"></a>00083                     current = <span class="stringliteral">&quot;Operating&quot;</span>; next = <span class="stringliteral">&quot;End&quot;</span>; transition = <span class="stringliteral">&quot;EvStop&quot;</span>;
<a name="l00084"></a>00084                     Expect.Call(() =&gt; this.observer.OnTransitionBegin(contextName, current, next, transition));
<a name="l00085"></a>00085 
<a name="l00086"></a>00086                     <span class="comment">// Leaving sub context engine.</span>
<a name="l00087"></a>00087                     Expect.Call(() =&gt; this.observer.OnExit(contextEngineName, <span class="stringliteral">&quot;EngineOff&quot;</span>));
<a name="l00088"></a>00088                     Expect.Call(() =&gt; this.observer.OnExit(contextEngineName, <span class="stringliteral">&quot;Engine&quot;</span>));
<a name="l00089"></a>00089 
<a name="l00090"></a>00090                     <span class="comment">// Leaving sub context door.</span>
<a name="l00091"></a>00091                     Expect.Call(() =&gt; this.observer.OnExit(contextDoorName, <span class="stringliteral">&quot;DoorClosed&quot;</span>));
<a name="l00092"></a>00092                     Expect.Call(() =&gt; this.observer.OnExit(contextDoorName, <span class="stringliteral">&quot;Door&quot;</span>));
<a name="l00093"></a>00093 
<a name="l00094"></a>00094                     Expect.Call(() =&gt; this.observer.OnExit(contextName, current));
<a name="l00095"></a>00095                     Expect.Call(() =&gt; this.observer.OnEntry(contextName, next));
<a name="l00096"></a>00096                     Expect.Call(() =&gt; this.observer.OnTransitionEnd(contextName, current, next, transition));
<a name="l00097"></a>00097                 }
<a name="l00098"></a>00098             }
<a name="l00099"></a>00099 
<a name="l00100"></a>00100             <span class="keyword">using</span> (repository.Playback())
<a name="l00101"></a>00101             {
<a name="l00102"></a>00102                 this.microwave.EvStop();
<a name="l00103"></a>00103             }
<a name="l00104"></a>00104         }
<a name="l00105"></a>00105 
<a name="l00109"></a>00109         [Test]
<a name="l00110"></a><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#a176182a4cf70ae994c805371cfff5675">00110</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> EvStartEvTurnOnEvDoorOpened()
<a name="l00111"></a>00111         {
<a name="l00112"></a>00112             this.microwave.EvStart();
<a name="l00113"></a>00113             this.microwave.Observer = observer;
<a name="l00114"></a>00114 
<a name="l00115"></a>00115             <span class="keyword">using</span> (repository.Record())
<a name="l00116"></a>00116             {
<a name="l00117"></a>00117                 <span class="keyword">using</span> (repository.Ordered())
<a name="l00118"></a>00118                 {
<a name="l00119"></a>00119                     <span class="comment">// this.context.EvTurnOn();</span>
<a name="l00120"></a>00120                     current = <span class="stringliteral">&quot;EngineOff&quot;</span>; next = <span class="stringliteral">&quot;EngineCooking&quot;</span>; transition = <span class="stringliteral">&quot;EvTurnOn&quot;</span>;
<a name="l00121"></a>00121                     Expect.Call(() =&gt; this.observer.OnTransitionBegin(contextEngineName, current, next, transition));
<a name="l00122"></a>00122 
<a name="l00123"></a>00123                     Expect.Call(() =&gt; this.observer.OnExit(contextEngineName, current));
<a name="l00124"></a>00124                     Expect.Call(() =&gt; this.observer.OnEntry(contextEngineName, <span class="stringliteral">&quot;EngineOn&quot;</span>));
<a name="l00125"></a>00125                     Expect.Call(() =&gt; this.observer.OnEntry(contextEngineName, next));
<a name="l00126"></a>00126 
<a name="l00127"></a>00127                     Expect.Call(() =&gt; this.observer.OnTransitionEnd(contextEngineName, current, next, transition));
<a name="l00128"></a>00128 
<a name="l00129"></a>00129                     <span class="comment">// Engine: this.context.EvDoorOpened(); </span>
<a name="l00130"></a>00130                     current = <span class="stringliteral">&quot;EngineCooking&quot;</span>; next = <span class="stringliteral">&quot;EngineWaitDoorToClose&quot;</span>; transition = <span class="stringliteral">&quot;EvDoorOpened&quot;</span>;
<a name="l00131"></a>00131                     Expect.Call(() =&gt; this.observer.OnTransitionBegin(contextEngineName, current, next, transition));
<a name="l00132"></a>00132                     Expect.Call(() =&gt; this.observer.OnExit(contextEngineName, current));
<a name="l00133"></a>00133                     Expect.Call(() =&gt; this.observer.OnEntry(contextEngineName, next));
<a name="l00134"></a>00134                     Expect.Call(() =&gt; this.observer.OnTransitionEnd(contextEngineName, current, next, transition));
<a name="l00135"></a>00135 
<a name="l00136"></a>00136                     <span class="comment">// Door: this.context.EvDoorOpened(); </span>
<a name="l00137"></a>00137                     current = <span class="stringliteral">&quot;DoorClosed&quot;</span>; next = <span class="stringliteral">&quot;DoorOpened&quot;</span>; transition = <span class="stringliteral">&quot;EvDoorOpened&quot;</span>;
<a name="l00138"></a>00138                     Expect.Call(() =&gt; this.observer.OnTransitionBegin(contextDoorName, current, next, transition));
<a name="l00139"></a>00139                     Expect.Call(() =&gt; this.observer.OnExit(contextDoorName, current));
<a name="l00140"></a>00140                     Expect.Call(() =&gt; this.observer.OnEntry(contextDoorName, next));
<a name="l00141"></a>00141                     Expect.Call(() =&gt; this.observer.OnTransitionEnd(contextDoorName, current, next, transition));
<a name="l00142"></a>00142                 }
<a name="l00143"></a>00143             }
<a name="l00144"></a>00144 
<a name="l00145"></a>00145             <span class="keyword">using</span> (repository.Playback())
<a name="l00146"></a>00146             {
<a name="l00147"></a>00147                 this.microwave.EvTurnOn();
<a name="l00148"></a>00148                 this.microwave.EvDoorOpened();
<a name="l00149"></a>00149             }
<a name="l00150"></a>00150         }
<a name="l00151"></a>00151 
<a name="l00155"></a>00155         [Test]
<a name="l00156"></a><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#ac7c33041e38cf6ebf21b5d49b15b61fc">00156</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> EvStart_EvTurnOn_EvTurnOff()
<a name="l00157"></a>00157         {
<a name="l00158"></a>00158             this.microwave.EvStart();
<a name="l00159"></a>00159             this.microwave.EvTurnOn();
<a name="l00160"></a>00160             this.microwave.Observer = observer;
<a name="l00161"></a>00161 
<a name="l00162"></a>00162             <span class="keyword">using</span> (repository.Record())
<a name="l00163"></a>00163             {
<a name="l00164"></a>00164                 <span class="keyword">using</span> (repository.Ordered())
<a name="l00165"></a>00165                 {
<a name="l00166"></a>00166                     <span class="comment">// this.context.EvTurnOn();</span>
<a name="l00167"></a>00167                     current = <span class="stringliteral">&quot;EngineCooking&quot;</span>; next = <span class="stringliteral">&quot;EngineOff&quot;</span>; transition = <span class="stringliteral">&quot;EvTurnOff&quot;</span>;
<a name="l00168"></a>00168                     Expect.Call(() =&gt; this.observer.OnTransitionBegin(contextEngineName, current, next, transition));
<a name="l00169"></a>00169 
<a name="l00170"></a>00170                     Expect.Call(() =&gt; this.observer.OnExit(contextEngineName, current));
<a name="l00171"></a>00171                     Expect.Call(() =&gt; this.observer.OnExit(contextEngineName, <span class="stringliteral">&quot;EngineOn&quot;</span>));
<a name="l00172"></a>00172                     Expect.Call(() =&gt; this.observer.OnEntry(contextEngineName, next));
<a name="l00173"></a>00173 
<a name="l00174"></a>00174                     Expect.Call(() =&gt; this.observer.OnTransitionEnd(contextEngineName, current, next, transition));
<a name="l00175"></a>00175                 }
<a name="l00176"></a>00176             }
<a name="l00177"></a>00177 
<a name="l00178"></a>00178             <span class="keyword">using</span> (repository.Playback())
<a name="l00179"></a>00179             {
<a name="l00180"></a>00180                 this.microwave.EvTurnOff();
<a name="l00181"></a>00181             }
<a name="l00182"></a>00182         }
<a name="l00183"></a>00183 
<a name="l00187"></a>00187         [Test]
<a name="l00188"></a><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#ad1debb420d26a141fea04389224e05e2">00188</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> EvStart_EvTurnOn_EvStop()
<a name="l00189"></a>00189         {
<a name="l00190"></a>00190             this.microwave.EvStart();
<a name="l00191"></a>00191             this.microwave.EvTurnOn();
<a name="l00192"></a>00192             this.microwave.Observer = observer;
<a name="l00193"></a>00193 
<a name="l00194"></a>00194             <span class="keyword">using</span> (repository.Record())
<a name="l00195"></a>00195             {
<a name="l00196"></a>00196                 <span class="keyword">using</span> (repository.Ordered())
<a name="l00197"></a>00197                 {
<a name="l00198"></a>00198                     <span class="comment">// this.context.EvStop();</span>
<a name="l00199"></a>00199                     current = <span class="stringliteral">&quot;Operating&quot;</span>; next = <span class="stringliteral">&quot;End&quot;</span>; transition = <span class="stringliteral">&quot;EvStop&quot;</span>;
<a name="l00200"></a>00200                     Expect.Call(() =&gt; this.observer.OnTransitionBegin(contextName, current, next, transition));
<a name="l00201"></a>00201 
<a name="l00202"></a>00202                     <span class="comment">// Leaving sub context engine</span>
<a name="l00203"></a>00203                     Expect.Call(() =&gt; this.observer.OnExit(contextEngineName, <span class="stringliteral">&quot;EngineCooking&quot;</span>));
<a name="l00204"></a>00204                     Expect.Call(() =&gt; this.observer.OnExit(contextEngineName, <span class="stringliteral">&quot;EngineOn&quot;</span>));
<a name="l00205"></a>00205                     Expect.Call(() =&gt; this.observer.OnExit(contextEngineName, <span class="stringliteral">&quot;Engine&quot;</span>));
<a name="l00206"></a>00206                     <span class="comment">// Leaving sub context door</span>
<a name="l00207"></a>00207                     Expect.Call(() =&gt; this.observer.OnExit(contextDoorName, <span class="stringliteral">&quot;DoorClosed&quot;</span>));
<a name="l00208"></a>00208                     Expect.Call(() =&gt; this.observer.OnExit(contextDoorName, <span class="stringliteral">&quot;Door&quot;</span>));
<a name="l00209"></a>00209 
<a name="l00210"></a>00210                     <span class="comment">// Leaving context</span>
<a name="l00211"></a>00211                     Expect.Call(() =&gt; this.observer.OnExit(contextName, current));
<a name="l00212"></a>00212 
<a name="l00213"></a>00213                     Expect.Call(() =&gt; this.observer.OnEntry(contextName, next));
<a name="l00214"></a>00214                     Expect.Call(() =&gt; this.observer.OnTransitionEnd(contextName, current, next, transition));
<a name="l00215"></a>00215                 }
<a name="l00216"></a>00216             }
<a name="l00217"></a>00217 
<a name="l00218"></a>00218             <span class="keyword">using</span> (repository.Playback())
<a name="l00219"></a>00219             {
<a name="l00220"></a>00220                 this.microwave.EvStop();
<a name="l00221"></a>00221             }
<a name="l00222"></a>00222         }
<a name="l00223"></a>00223 
<a name="l00227"></a>00227         [Test]
<a name="l00228"></a><a class="code" href="class_state_forge_1_1_examples_1_1_microwave_1_1_microwave_test.html#ac59f9285e6da9fbe8d5688fe93daf2f1">00228</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> EvStartEvDoorOpenedEvTurnOn()
<a name="l00229"></a>00229         {
<a name="l00230"></a>00230             this.microwave.EvStart();
<a name="l00231"></a>00231             
<a name="l00232"></a>00232             this.microwave.Observer = observer;
<a name="l00233"></a>00233 
<a name="l00234"></a>00234             <span class="keyword">using</span> (repository.Record())
<a name="l00235"></a>00235             {
<a name="l00236"></a>00236                 <span class="keyword">using</span> (repository.Ordered())
<a name="l00237"></a>00237                 {
<a name="l00238"></a>00238 
<a name="l00239"></a>00239                     <span class="comment">// Door: this.context.EvDoorOpened(); </span>
<a name="l00240"></a>00240                     current = <span class="stringliteral">&quot;DoorClosed&quot;</span>; next = <span class="stringliteral">&quot;DoorOpened&quot;</span>; transition = <span class="stringliteral">&quot;EvDoorOpened&quot;</span>;
<a name="l00241"></a>00241                     Expect.Call(() =&gt; this.observer.OnTransitionBegin(contextDoorName, current, next, transition));
<a name="l00242"></a>00242                     Expect.Call(() =&gt; this.observer.OnExit(contextDoorName, current));
<a name="l00243"></a>00243                     Expect.Call(() =&gt; this.observer.OnEntry(contextDoorName, next));
<a name="l00244"></a>00244                     Expect.Call(() =&gt; this.observer.OnTransitionEnd(contextDoorName, current, next, transition));
<a name="l00245"></a>00245                     
<a name="l00246"></a>00246                     <span class="comment">// this.context.EvTurnOn();</span>
<a name="l00247"></a>00247                     current = <span class="stringliteral">&quot;EngineOff&quot;</span>; next = <span class="stringliteral">&quot;EngineWaitDoorToClose&quot;</span>; transition = <span class="stringliteral">&quot;EvTurnOn[context.ContextParent.MicrowaveOperatingParallel.MicrowaveDoorContext.StateCurrent == MicrowaveDoorOpenedState.Instance]&quot;</span>;
<a name="l00248"></a>00248                     Expect.Call(() =&gt; this.observer.OnTransitionBegin(contextEngineName, current, next, transition));
<a name="l00249"></a>00249 
<a name="l00250"></a>00250                     Expect.Call(() =&gt; this.observer.OnExit(contextEngineName, current));
<a name="l00251"></a>00251                     Expect.Call(() =&gt; this.observer.OnEntry(contextEngineName, <span class="stringliteral">&quot;EngineOn&quot;</span>));
<a name="l00252"></a>00252                     Expect.Call(() =&gt; this.observer.OnEntry(contextEngineName, next));
<a name="l00253"></a>00253 
<a name="l00254"></a>00254                     Expect.Call(() =&gt; this.observer.OnTransitionEnd(contextEngineName, current, next, transition));
<a name="l00255"></a>00255 
<a name="l00256"></a>00256                     <span class="comment">// Engine: this.context.EvDoorClosed(); </span>
<a name="l00257"></a>00257                     current = <span class="stringliteral">&quot;EngineWaitDoorToClose&quot;</span>; next = <span class="stringliteral">&quot;EngineCooking&quot;</span>; transition = <span class="stringliteral">&quot;EvDoorClosed&quot;</span>;
<a name="l00258"></a>00258                     Expect.Call(() =&gt; this.observer.OnTransitionBegin(contextEngineName, current, next, transition));
<a name="l00259"></a>00259                     Expect.Call(() =&gt; this.observer.OnExit(contextEngineName, current));
<a name="l00260"></a>00260                     Expect.Call(() =&gt; this.observer.OnEntry(contextEngineName, next));
<a name="l00261"></a>00261                     Expect.Call(() =&gt; this.observer.OnTransitionEnd(contextEngineName, current, next, transition));
<a name="l00262"></a>00262 
<a name="l00263"></a>00263                     <span class="comment">// Door: this.context.EvDoorClosed(); </span>
<a name="l00264"></a>00264                     current = <span class="stringliteral">&quot;DoorOpened&quot;</span>; next = <span class="stringliteral">&quot;DoorClosed&quot;</span>; transition = <span class="stringliteral">&quot;EvDoorClosed&quot;</span>;
<a name="l00265"></a>00265                     Expect.Call(() =&gt; this.observer.OnTransitionBegin(contextDoorName, current, next, transition));
<a name="l00266"></a>00266                     Expect.Call(() =&gt; this.observer.OnExit(contextDoorName, current));
<a name="l00267"></a>00267                     Expect.Call(() =&gt; this.observer.OnEntry(contextDoorName, next));
<a name="l00268"></a>00268                     Expect.Call(() =&gt; this.observer.OnTransitionEnd(contextDoorName, current, next, transition));
<a name="l00269"></a>00269                 }
<a name="l00270"></a>00270             }
<a name="l00271"></a>00271 
<a name="l00272"></a>00272             <span class="keyword">using</span> (repository.Playback())
<a name="l00273"></a>00273             {
<a name="l00274"></a>00274                 this.microwave.EvDoorOpened();
<a name="l00275"></a>00275                 this.microwave.EvTurnOn();
<a name="l00276"></a>00276                 this.microwave.EvDoorClosed();
<a name="l00277"></a>00277             }
<a name="l00278"></a>00278         }
<a name="l00279"></a>00279     }
<a name="l00280"></a>00280 }
</pre></div></div>
</div>
﻿<div id="footer">
    <hr />
    <p>
        Copyright &copy; 2011 StateForge.</p>
    <hr />
</div>
</body> </html> 
